import mockjs from 'mockjs';

export default {
  'POST /api/detector/getDetectorList': (req, res) => {
    const { size, deviceId } = req.body;
    if (deviceId != null && deviceId != undefined && deviceId != '') {
      res.send(
        mockjs.mock({
          code: 200,
          message: '请求成功',
          data: {
            total: 2,
            page: 1,
            'items|2': [
              {
                'id|+1': 1,
                'deviceId|1': '202223251522252',
                deviceName: '@name',
                trueName: '@name',
                'unitType|1': ['中国某品牌', '河南某型号', '郑州大学'],
                address: '@county(true)',
                'status|1': ['正常', '损坏', '停用'],
                'durableYear|1': [1, 2, 3, 4, 5, 6, 7, 8],
                producedDate: '@date',
                'devicePushUsers|3': [
                  {
                    'userId|+1': 1,
                    username: '@name',
                    'sex|1': ['男', '女'],
                    trueName: '@name',
                    telephone: '@phone',
                    email: '@email',
                    address: '@county(true)',
                    introduce: '@cparagraph',
                    'roleName|1': ['超级管理员', '管理员', '普通用户'],
                    registTime: '@date',
                  },
                ],
              },
            ],
          },
        }),
      );
    } else {
      res.send(
        mockjs.mock({
          code: 200,
          message: '请求成功',
          data: {
            total: 50,
            page: 5,
            'items|50': [
              {
                'id|+1': 1,
                'deviceId|1': '202223251522252',
                deviceName: '@name',
                trueName: '@name',
                'unitType|1': ['中国某品牌', '河南某型号', '郑州大学'],
                address: '@county(true)',
                'status|1': ['0', '1', '2'],
                'durableYear|1': [1, 2, 3, 4, 5, 6, 7, 8],
                producedDate: '@date',
                'devicePushUsers|3': [
                  {
                    'userId|+1': 1,
                    username: '@name',
                    'sex|1': ['男', '女'],
                    trueName: '@name',
                    telephone: '@phone',
                    email: '@email',
                    address: '@county(true)',
                    introduce: '@cparagraph',
                    'roleName|1': ['超级管理员', '管理员', '普通用户'],
                    registTime: '@date',
                  },
                ],
              },
            ],
          },
        }),
      );
    }
    return;
  },
  'POST /api/detector/insert': (req, res) => {
    res.send({
      code: 200,
      message: '添加成功',
      data: null,
    });
    return;
  },
  'POST /api/detector/update': (req, res) => {
    res.send({
      code: 200,
      message: '修改成功',
      data: null,
    });
    return;
  },
  'POST /api/detector/delete': (req, res) => {
    res.send({
      code: 200,
      message: '删除成功',
      data: null,
    });
    return;
  },
  'POST /api/detector/insertDetectorPushUserById': (req, res) => {
    res.send({
      code: 200,
      message: '追加设备管理用户成功',
      data: null,
    });
    return;
  },
  'POST /api/detector/deleteDetectorUser': (req, res) => {
    res.send({
      code: 200,
      message: '删除成功',
      data: null,
    });
    return;
  },
  'POST /api/detector/getDetectorInfoById': (req, res) => {
    res.send({
      code: 200,
      message: '查询成功',
      data: mockjs.mock({
        code: 200,
        message: '请求成功',
        data: {
          total: 50,
          page: 5,
          'items|1': [
            {
              'id|+1': 1,
              'deviceId|1': '202223251522252',
              deviceName: '@name',
              trueName: '@name',
              'unitType|1': ['中国某品牌', '河南某型号', '郑州大学'],
              address: '@county(true)',
              'status|1': ['正常', '损坏', '停用'],
              'durableYear|1': [1, 2, 3, 4, 5, 6, 7, 8],
              producedDate: '@date',
              'devicePushUsers|3': [
                {
                  'userId|+1': 1,
                  username: '@name',
                  'sex|1': ['男', '女'],
                  trueName: '@name',
                  telephone: '@phone',
                  email: '@email',
                  address: '@county(true)',
                  introduce: '@cparagraph',
                  'roleName|1': ['超级管理员', '管理员', '普通用户'],
                  registTime: '@date',
                },
              ],
            },
          ],
        },
      }),
    });
    return;
  },
};
